/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package searchers;

import model.Recipe;

/**
 *
 * @author zimi
 */
public class NameStartsSearcher implements Searcher {

    private String filterName;

    public NameStartsSearcher() {
    }

    public NameStartsSearcher(String filterName) {
        this.filterName = filterName;
    }

    public String getFilterName() {
        return filterName;
    }

    public void setFilterName(String filterName) {
        this.filterName = filterName;
    }

    public boolean isHit(Recipe recipe) {
        String name = recipe.getName().toLowerCase();
        return name.startsWith(filterName.toLowerCase());
    }

}
